﻿Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {


    buildExtractors: function () {
        Ext.data.ArrayReader.superclass.buildExtractors.apply(this, arguments); // 创建各种性质的属性存取器

        var fields = this.model.prototype.fields.items,
            length = fields.length,
            extractorFunctions = [],
            i;

        // 遍历模型的各字段
        for (i = 0; i < length; i++) {
            extractorFunctions.push(function (index) {
                return function (data) {
                    return data[index];
                };
            } (fields[i].mapping || i));
        }

        this.extractorFunctions = extractorFunctions; //覆盖一般属性存取器
    }
});

Ext.data.ReaderMgr.registerType('array', Ext.data.ArrayReader);